﻿using System;
using System.Collections.Generic;
using System.Text;
using System.Runtime.InteropServices;
using System.Reflection;
using Microsoft.Office.Interop;
using Microsoft.Office.Interop.Word;

namespace RenShiPinYongBiao
{
    abstract class WordPageBuilder
    {
        protected DataSourcePinYong source;
        protected Application app;
        protected Document doc;
        protected object missing = Type.Missing;
        protected int index = 0;
        public WordPageBuilder(DataSourcePinYong source,Application app)
        {
            this.source = source;
            this.app = app;
            this.doc = app.ActiveDocument;
        }
        public abstract void BuildPage();
        public virtual void NextPage()
        {
            index++;
        }
        public virtual void BuildArch(int number)
        {
            app.Selection.WholeStory();
            app.Selection.Copy();
            app.Selection.MoveDown(WdUnits.wdLine,1,WdMovementType.wdMove);
            app.Selection.InsertBreak(WdBreakType.wdPageBreak);
            for (int i = 0; i < number-2; i++)
            {
                app.Selection.PasteAndFormat(WdRecoveryType.wdFormatOriginalFormatting);
                app.Selection.InsertBreak(WdBreakType.wdPageBreak);
            }
            app.Selection.PasteAndFormat(WdRecoveryType.wdFormatOriginalFormatting);
        }
    }
}
